home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / doc / CrtPipelin.3 < prev    next >
Text File  |  1993-02-14  |  4KB  |  104 lines

  1. '\"
  2. '\" Copyright 1989 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. .so man.macros
  11. .HS Tcl_CreatePipeline tcl
  12. .VS
  13. .BS
  14. .SH NAME
  15. Tcl_CreatePipeline \- create one or more child processes, with I/O redirection
  16. .SH SYNOPSIS
  17. .nf
  18. \fB#include <tcl.h>\fR
  19. .sp
  20. int
  21. \fBTcl_CreatePipeline\fR(\fIinterp, argc, argv, pidArrayPtr, inPipePtr, outPipePtr, errFilePtr\fR)
  22. .SH ARGUMENTS
  23. .AS Tcl_Interp **pidArrayPtr
  24. .AP Tcl_Interp *interp in
  25. Interpreter to use for error reporting.
  26. .AP int argc in
  27. Number of strings in \fIargv\fR array.
  28. .AP char **argv in
  29. Array of strings describing command(s) and I/O redirection.
  30. .AP int **pidArrayPtr out
  31. The value at \fI*pidArrayPtr\fR is modified to hold a pointer to
  32. an array of process identifiers.  The array is dynamically
  33. allocated and must be freed by the caller.
  34. .AP char *inPipePtr out
  35. If this argument is NULL then standard input for the first command
  36. in the pipeline comes from the current standard input.
  37. If \fIinPipePtr\fR is not NULL then \fBTcl_CreatePipeline\fR will
  38. create a pipe, arrange for it to be used for standard input
  39. to the first command,
  40. and store a file id for writing to that pipe at \fI*inPipePtr\fR.
  41. If the command specified its own input using redirection, then
  42. no pipe is created and -1 is stored at \fI*inPipePtr\fR.
  43. .AP char *outPipePtr out
  44. If this argument is NULL then standard output for the last command
  45. in the pipeline goes to the current standard output.
  46. If \fIoutPipePtr\fR is not NULL then \fBTcl_CreatePipeline\fR will
  47. create a pipe, arrange for it to be used for standard output from
  48. the last command, and store a file id for reading from that
  49. pipe at \fI*outPipePtr\fR.
  50. If the command specified its own output using redirection then
  51. no pipe is created and -1 is stored at \fI*outPipePtr\fR.
  52. .AP char *errFilePtr out
  53. If this argument is NULL then error output for all the commands
  54. in the pipeline will go to the current standard error file.
  55. If \fIerrFilePtr\fR is not NULL, error output from all the commands
  56. in the pipeline will go to a temporary file created by
  57. \fBTcl_CreatePipeline\fR.
  58. A file id to read from that file will be stored at \fI*errFilePtr\fR.
  59. The file will already have been removed, so closing the file
  60. descriptor at \fI*errFilePtr\fR will cause the file to be flushed
  61. completely.
  62. .BE
  63.  
  64. .SH DESCRIPTION
  65. .PP
  66. \fBTcl_CreatePipeline\fR processes the \fIargv\fR array and sets
  67. up one or more child processes in a pipeline configuration.
  68. \fBTcl_CreatePipeline\fR handles pipes specified with ``|'',
  69. input redirection specified with ``<'' or ``<<'', and output
  70. redirection specified with ``>'';  see the documentation for
  71. the \fBexec\fR command for details on these specifications.
  72. The return value from \fBTcl_CreatePipeline\fR is a count of
  73. the number of child processes created;  the process identifiers
  74. for those processes are stored in a \fImalloc\fR-ed array and
  75. a pointer to that array is stored at \fI*pidArrayPtr\fR.
  76. It is the caller's responsibility to free the array when finished
  77. with it.
  78. .PP
  79. If the \fIinPipePtr\fR, \fIoutPipePtr\fR, and \fIerrFilePtr\fR
  80. arguments are NULL then the pipeline's standard input, standard
  81. output, and standard error are taken from the corresponding
  82. streams of the process.  Non-NULL values may be specified for
  83. these arguments to use pipes for standard input and standard
  84. output and a file for standard error.  \fBTcl_CreatePipeline\fR
  85. will create the requested pipes or file and return file identifiers
  86. that may be used to read or write them.  It is the caller's
  87. responsibility to close all of these files when they are no
  88. longer needed.  If \fIargv\fR specifies redirection for standard
  89. input or standard output, then pipes will not be created even
  90. if requested by the \fIinPipePtr\fR and \fIoutPipePtr\fR
  91. arguments.
  92. .PP
  93. If an error occurs in \fBTcl_CreatePipeline\fR (e.g. ``|'' or
  94. ``<'' was the last argument in \fIargv\fR, or it wasn't possible
  95. to fork off a child), then -1 is returned
  96. and \fIinterp->result\fR is set to an error message.
  97.  
  98. .SH "SEE ALSO"
  99. \fBTcl_WaitPids\fR, \fBTcl_DetachPids\fR
  100.  
  101. .SH KEYWORDS
  102. background, child, detach, fork, process, status, wait
  103. .VE
  104.